var utils = require("../../utils/utils");
var ocrGml = require("../../utils/ocrGml");
var ACTION = require("../../base/action");
var common = require("./common");
var baoShuangAd = require("../appCommon/baoShuangAd");
var appUtils = require("../../utils/app");
var pointMap = {
  我的: {
    points: [
      //prettier-ignore
      864, 2161, 1080, 2356,
    ],
    size: {
      x: 1080,
      y: 2340,
    },
  },
  短剧推荐: {
    points: [
      //prettier-ignore
      216, 2161, 432, 2356,
    ],
    size: {
      x: 1080,
      y: 2340,
    },
  },
  观看记录: {
    points: [
      //prettier-ignore
      465, 2161, 615, 2356,
    ],
    size: {
      x: 1080,
      y: 2340,
    },
  },
};
var aRandom = new ACTION("随机行为", {
  storgae: common.storage,
});
aRandom.inMy = function () {
  var number = utils.getRandom(1, 100);
  if (number >= 20 && number < 40) {
    var content = "去提现";
    if (utils.clickTextStartsWith(content)) {
      sleep(utils.getRandom(1.5, 6, 1000));
      back();
    }
  }
  if (number >= 60 && number < 70) {
    var content = "隐私政策";
    if (utils.clickTextStartsWith(content)) {
      sleep(utils.getRandom(1.5, 6, 1000));
      back();
    }
  }
  if (number >= 90 && number < 100) {
    var content = "注销账户";
    if (utils.clickTextStartsWith(content)) {
      sleep(utils.getRandom(1.5, 6, 1000));
      back();
    }
  }
};
aRandom.exec = function () {
  var number = utils.getRandom(1, 100);
  if (number >= 20 && number < 40) {
    utils.clickPointMap(pointMap["我的"]);
    console.log("我的");
    sleep(utils.getRandom(1.5, 6, 1000));
    this.inMy();
  }
  if (number >= 60 && number < 70) {
    utils.clickPointMap(pointMap["短剧推荐"]);
    console.log("短剧推荐");
    sleep(utils.getRandom(1.5, 6, 1000));
  }
  if (number >= 80 && number < 100) {
    utils.clickPointMap(pointMap["观看记录"]);
    console.log("观看记录");
    sleep(utils.getRandom(1.5, 6, 1000));
  }
};

module.exports = aRandom;
